from django.http import JsonResponse

from untils.auth import already_authorized
from untils.response import CommonResponseMixin, ReturnCode


def __get_auth_status(request):
    if already_authorized(request):
        data = {'is_Authorized': 1}
    else:
        data = {'is_Authorized': 0}
    response = CommonResponseMixin.wrap_json_response(data=data,code=ReturnCode.SUCCESS)
    return JsonResponse(response,safe=False)


def get_status(request):
    return __get_auth_status(request)